#include "GmSSLServantImp.h"
#include "servant/Application.h"
#include "TGGmSSL.h"

using namespace std;

//////////////////////////////////////////////////////
void GmSSLServantImp::initialize()
{
	//initialize servant here:
	//...
}

//////////////////////////////////////////////////////
void GmSSLServantImp::destroy()
{
	//destroy servant here:
	//...
}

taf::Int32 GmSSLServantImp::tg_gen_sm2_key(std::string &pub_key,std::string &pri_key,taf::JceCurrentPtr current)
{
	pair<string, string> keys = sm2_genKey();
	pub_key = keys.first;
	pri_key = keys.second;

	return 0;
}

taf::Int32 GmSSLServantImp::tg_sm2_sign(const std::string & pri_key,const std::string & plain_text,
								const std::string & id,std::string &sign_ret,taf::JceCurrentPtr current)
{
	sign_ret = sm2_sign(pri_key, plain_text, id);

	return 0;
}

taf::Int32 GmSSLServantImp::tg_sm2_verify(const std::string & pub_key,const std::string & origin_plain,const std::string & sig,
									const std::string & id,taf::Int32 &verify_ret,taf::JceCurrentPtr current)
{
	verify_ret = sm2_verify(pub_key, origin_plain, sig, id);
	return 0;
}

